package com.zuoban.util;

import org.apache.shiro.SecurityUtils;

import java.math.BigInteger;
import java.util.concurrent.atomic.AtomicReference;

/**
 * @BelongsProject: zuoban-boot
 * @BelongsPackage: com.zuoban.util
 * @Author: zxy
 * @CreateTime: 2022-10-10  10:59
 */
public class CurrentUser {
    public static BigInteger getUserId(){
        try {
            return ((AtomicReference<BigInteger>) SecurityUtils.getSubject().getPrincipal()).get();
        } catch (Exception exception) {
            return null;
        }
    }
}
